package no.hio.wsprovider.vo;

import static org.junit.Assert.*;
import junit.framework.TestCase;
import no.hio.wsprovider.vo.Product;

import org.junit.Before;
import org.junit.Test;

public class ProductTestCase extends TestCase {

	Product identical1, identical2, notIdentical;
	@Before
	public void setUp() throws Exception {
	
		identical1 = new Product();
		identical2 = new Product();
		identical1.setProductID(1);
		identical2.setProductID(1);
		identical1.setTitle("TV");
		identical2.setTitle("TV");
		identical1.setDescription("Television");
		identical2.setDescription("Television");
		identical1.setPrice(100.0);
		identical2.setPrice(100.0);
		
		notIdentical = new Product();
		notIdentical.setProductID(2);
		notIdentical.setTitle("TV");
		notIdentical.setDescription("Great television");
		notIdentical.setPrice(100.0);
		
		
	}

	@Test
	public void testEqualsObject() {
		assertTrue("Objektene skal være like 1", identical1.equals(identical2));
		assertTrue("Objektet skal være likt seg selv", identical2.equals(identical2));
		assertFalse("Objektene skal ikke være like 1", notIdentical.equals(identical1));
	}

}
